package com.ccp.dev.workflow.model;

import com.alibaba.fastjson.JSONArray;
import com.ccp.dev.core.basic.model.BaseModel;
import com.ccp.dev.core.util.StringUtil;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

import javax.xml.bind.annotation.*;
import java.util.Collections;
import java.util.List;

/**
 * ClassDescribe    任务节点催办时间设置 Model对象
 *
 * @author: fanruiqi
 * Date: 2019-10-17
 * Since:1
 * To change this template use File | Settings | File Templates.
 */
@XmlRootElement(name = "taskReminder")
@XmlAccessorType(XmlAccessType.NONE)
public class TaskReminder extends BaseModel<TaskReminder> {
    /**
     *  时间设置ID
     */
    @XmlAttribute
    private String taskDueId;
    /**
     *  流程定义ID
     */
    @XmlAttribute
    private String procDefId;
    /**
     *  流程节点ID
     */
    @XmlAttribute
    private String nodeId;
    /**
     *  催办开始时间(相对于任务创建时间，多少工作日)
     */
    @XmlAttribute
    private Integer reminderStart;
    /**
     *  催办持续时间(相对于催办开始时间)
     */
    @XmlAttribute
    private Integer reminderEnd;
    /**
     *  催办次数
     */
    @XmlAttribute
    private Integer times;
    /**
     *  催办提醒短信内容
     */
    @XmlAttribute
    private String mailContent;
    /**
     *  催办邮件模板内容
     */
    @XmlAttribute
    private String msgContent;
    /**
     *  催办邮件模板内容
     */
    @XmlAttribute
    private String smsContent;
    /**
     *  任务到期处理动作
     */
    @XmlAttribute
    private Integer action;
    /**
     *  script
     */
    @XmlAttribute
    private String script;
    /**
     *  completeTime
     */
    @XmlAttribute
    private Integer completeTime;
    /**
     *  条件表达式
     */
    @XmlAttribute
    private String condExp;
    /**
     *  名称
     */
    @XmlAttribute
    private String name;
    /**
     * 相对节点的节点ID
     */
    @XmlAttribute
    private String relativeNodeId;
    /**
     * 相对节点的动作
     */
    @XmlAttribute
    private Integer relativeNodeType;
    /**
     * 相对时间类型
     */
    @XmlAttribute
    private Integer relativeTimeType;
    /**
     * 指定的交办人ID
     */
    @XmlAttribute
    private String assignerId;

    /**
     * 指定的交办人名称
     */
    @XmlAttribute
    private String assignerName;
    /**
     * 预警设置json
     */
    @XmlElement
    private String warningSetJson;
    /**
     * 预警项列表
     */
    private List<TaskWarningSet> taskWarningSetList;


    public String getWarningSetJson() {
        return warningSetJson;
    }
    public void setWarningSetJson(String warningSetJson) {
        this.warningSetJson = warningSetJson;
    }
    public List<TaskWarningSet> getTaskWarningSetList() {
        if(taskWarningSetList!=null) {return taskWarningSetList;}
        if(StringUtil.isEmpty(warningSetJson)){ return Collections.emptyList(); }

        return JSONArray.parseArray(warningSetJson, TaskWarningSet.class);
    }
    public void setTaskDueId(String taskDueId)
    {
        this.taskDueId = taskDueId;
    }
    /**
     * 返回 时间设置ID
     * @return
     */
    public String getTaskDueId()
    {
        return taskDueId;
    }

    public void setProcDefId(String procDefId)
    {
        this.procDefId = procDefId;
    }
    /**
     * 返回 流程定义ID
     * @return
     */
    public String getProcDefId()
    {
        return procDefId;
    }

    public void setNodeId(String nodeId)
    {
        this.nodeId = nodeId;
    }
    /**
     * 返回 流程节点ID
     * @return
     */
    public String getNodeId()
    {
        return nodeId;
    }

    public void setReminderStart(Integer reminderStart)
    {
        this.reminderStart = reminderStart;
    }
    /**
     * 返回 催办开始时间(相对于任务创建时间，多少工作日)
     * @return
     */
    public Integer getReminderStart()
    {
        return reminderStart;
    }

    public void setReminderEnd(Integer reminderEnd)
    {
        this.reminderEnd = reminderEnd;
    }
    /**
     * 返回 催办结束时间(相对于催办开始时间)
     * @return
     */
    public Integer getReminderEnd()
    {
        return reminderEnd;
    }

    public void setTimes(Integer times)
    {
        this.times = times;
    }
    /**
     * 返回 催办次数
     * @return
     */
    public Integer getTimes()
    {
        return times;
    }

    public void setMailContent(String mailContent)
    {
        this.mailContent = mailContent;
    }
    /**
     * 返回 催办提醒短信内容
     * @return
     */
    public String getMailContent()
    {
        return mailContent;
    }

    public void setMsgContent(String msgContent)
    {
        this.msgContent = msgContent;
    }
    /**
     * 返回 催办邮件模板内容
     * @return
     */
    public String getMsgContent()
    {
        return msgContent;
    }

    public void setSmsContent(String smsContent)
    {
        this.smsContent = smsContent;
    }
    /**
     * 返回 催办邮件模板内容
     * @return
     */
    public String getSmsContent()
    {
        return smsContent;
    }

    public void setAction(Integer action)
    {
        this.action = action;
    }
    /**
     * 返回 任务到期处理动作
     * @return
     */
    public Integer getAction()
    {
        return action;
    }

    public void setScript(String script)
    {
        this.script = script;
    }
    /**
     * 返回 script
     * @return
     */
    public String getScript()
    {
        return script;
    }

    public void setCompleteTime(Integer completeTime)
    {
        this.completeTime = completeTime;
    }
    /**
     * 返回 completeTime
     * @return
     */
    public Integer getCompleteTime()
    {
        return completeTime;
    }


    public String getCondExp() {
        return condExp;
    }
    public void setCondExp(String condExp) {
        this.condExp = condExp;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getRelativeNodeId() {
        return relativeNodeId;
    }
    public void setRelativeNodeId(String relativeNodeId) {
        this.relativeNodeId = relativeNodeId;
    }
    public Integer getRelativeNodeType() {
        return relativeNodeType;
    }
    public void setRelativeNodeType(Integer relativeNodeType) {
        this.relativeNodeType = relativeNodeType;
    }
    public Integer getRelativeTimeType() {
        return relativeTimeType;
    }
    public void setRelativeTimeType(Integer relativeTimeType) {
        this.relativeTimeType = relativeTimeType;
    }
    public String getAssignerId() {
        return assignerId;
    }
    public void setAssignerId(String assignerId) {
        this.assignerId = assignerId;
    }
    public String getAssignerName() {
        return assignerName;
    }
    public void setAssignerName(String assignerName) {
        this.assignerName = assignerName;
    }
    /**
     * @see java.lang.Object#equals(Object)
     */
    @Override
    public boolean equals(Object object)
    {
        if (!(object instanceof TaskReminder))
        {
            return false;
        }
        TaskReminder rhs = (TaskReminder) object;
        return new EqualsBuilder()
                .append(this.taskDueId, rhs.taskDueId)
                .append(this.procDefId, rhs.procDefId)
                .append(this.nodeId, rhs.nodeId)
                .append(this.reminderStart, rhs.reminderStart)
                .append(this.reminderEnd, rhs.reminderEnd)
                .append(this.times, rhs.times)
                .append(this.mailContent, rhs.mailContent)
                .append(this.msgContent, rhs.msgContent)
                .append(this.smsContent, rhs.smsContent)
                .append(this.action, rhs.action)
                .append(this.script, rhs.script)
                .append(this.completeTime, rhs.completeTime)
                .isEquals();
    }

    /**
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode()
    {
        return new HashCodeBuilder(-82280557, -700257973)
                .append(this.taskDueId)
                .append(this.procDefId)
                .append(this.nodeId)
                .append(this.reminderStart)
                .append(this.reminderEnd)
                .append(this.times)
                .append(this.mailContent)
                .append(this.msgContent)
                .append(this.smsContent)
                .append(this.action)
                .append(this.script)
                .append(this.completeTime)
                .toHashCode();
    }

    /**
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString()
    {
        return new ToStringBuilder(this)
                .append("taskDueId", this.taskDueId)
                .append("actDefId", this.procDefId)
                .append("nodeId", this.nodeId)
                .append("reminderStart", this.reminderStart)
                .append("reminderEnd", this.reminderEnd)
                .append("times", this.times)
                .append("mailContent", this.mailContent)
                .append("msgContent", this.msgContent)
                .append("smsContent", this.smsContent)
                .append("action", this.action)
                .append("script", this.script)
                .append("completeTime", this.completeTime)
                .toString();
    }
}
